<%@ page language="java" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="tag" prefix="PF" %>
<%--
  ~ This file Copyright (c) 2015. Walle.
  ~ (http://www.wallellen.com). All rights reserved.
  ~
  ~
  ~ This file is dual-licensed under both the
  ~ Walle Agreement (WA) and the GNU General Public License.
  ~ You may elect to use one or the other of these licenses.
  ~
  ~ This file is distributed in the hope that it will be
  ~ useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
  ~ implied warranty of MERCHANTABILITY or FITNESS FOR A
  ~ PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
  ~ Redistribution, except as permitted by whichever of the GPL
  ~ or WA you select, is prohibited.
  ~
  ~ 1. For the GPL license (GPL), you can redistribute and/or
  ~ modify this file under the terms of the GNU General
  ~ Public License, Version 3, as published by the Free Software
  ~ Foundation.  You should have received a copy of the GNU
  ~ General Public License, Version 3 along with this program;
  ~ if not, write to the Free Software Foundation, Inc., 51
  ~ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  ~
  ~ 2. For the Walle Agreement (WA), this file
  ~ and the accompanying materials are made available under the
  ~ terms of the WA which accompanies this distribution, and
  ~ is available at http://www.wallellen.com/agreement.html
  ~
  ~
  ~ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
  --%>

<c:if test="${VERSIONS != null }">
    <div class="row doc_column_box">
        <div class="col-sm-12">
            <span class="glyphicon glyphicon-dashboard   column_title">历史版本</span>
            <a name="markdocVersions"></a>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <hr class="hr_split"/>
            <div id="DocVersionsBoxId">
                <table class="table table-bordered table-hover"
                       style="font-size: 12px;">
                    <tr class="active">
                        <td><b>修改日期</b></td>
                        <td><b>修改人</b></td>
                        <td><b>备注</b></td>
                    </tr>
                    <c:set var="isShowAllVersion" value="false"></c:set>
                    <c:forEach items="${VERSIONS}" var="node" varStatus="status">
                        <c:if test="${status.index==0}">
                            <tr>
                                <td><a href="webdoc/view/Pub${DOCE.doc.id}.html"><PF:FormatTime
                                        date="${node.etime}" yyyyMMddHHmmss="yyyy-MM-dd HH:mm:ss"/>[当前版本]
                                </a></td>
                                <td>${node.cusername}</td>
                                <td>${node.pcontent}</td>
                            </tr>
                        </c:if>
                        <c:if test="${status.index<=3&&status.index>0}">
                            <tr>
                                <td><a href="webdoc/PubVersion.do?textid=${node.id}"><PF:FormatTime
                                        date="${node.etime}" yyyyMMddHHmmss="yyyy-MM-dd HH:mm:ss"/>
                                </a></td>
                                <td>${node.cusername}</td>
                                <td>${node.pcontent}</td>
                            </tr>
                        </c:if>
                        <c:if test="${status.index>3}">
                            <c:set var="isShowAllVersion" value="true"></c:set>
                            <tr class="hideVersionTr" style="display: none;">
                                <td><a href="webdoc/PubVersion.do?textid=${node.id}"><PF:FormatTime
                                        date="${node.etime}" yyyyMMddHHmmss="yyyy-MM-dd HH:mm:ss"/></a>
                                </td>
                                <td>${node.cusername}</td>
                                <td>${node.pcontent}</td>
                            </tr>
                        </c:if>
                    </c:forEach>
                    <c:if test="${isShowAllVersion}">
                        <tr>
                            <td colspan="3" style="text-align: center;">
                                <button type="button" id="ShowAllVersionId"
                                        class="btn btn-primary btn-xs">显示全部版本
                                </button>
                            </td>
                        </tr>
                    </c:if>
                </table>
                <script type="text/javascript">
                    $(function () {
                        $('#ShowAllVersionId').bind('click', function () {
                            $('.hideVersionTr').show();
                            $('#ShowAllVersionId').hide();
                        });
                    });
                </script>
            </div>
        </div>
    </div>
</c:if>


